import { getAction, putAction } from '@/api/manage'

import { serviceApi } from '@/api/common.js'
/**
 * 公共API接口
 */
export const api = {

}

/**
 * 获取应用列表树
 * @param {*} params
 * @returns
 */
export const getAppTree = params => getAction(serviceApi.auth + '/apps/list-tree-undelete', params);

/**
* 获取应用已分配的权限树（应用默认角色）
* @param {*} params
* @returns
*/
export const getPermissionTree = (roleId, params) => getAction(serviceApi.auth + `/roles/${roleId}/permissions/trees`, params);

/**
* 获取租户权限
* @param {*} params
* @returns
*/
export const getTenantPermission = (tenantId, params) => getAction(serviceApi.auth + `/tenants/${tenantId}/apps/permissions`, params);

/**
* 保存租户应用权限
* @param {*} params
* @returns
*/
export const saveTenantPermission = (tenantId, params) => putAction(serviceApi.auth + `/tenants/${tenantId}/apps`, params);

/**
* 获取租户权限详情
* @param {*} params
* @returns
*/
export const getTenantDetailPermission = (tenantId, params) => getAction(serviceApi.auth + `/tenants/${tenantId}/apps/permissions/detail`, params);

/**
* 获取租户应用列表树
* @param {*} params
* @returns
*/
export const listTenantAppTree = (tenantId, params) => getAction(serviceApi.auth + `/tenants/${tenantId}/apps`, params)
